﻿using UnityEngine;
using System.Collections;

public class joinButtonScript : MonoBehaviour {
	
	public string playerName;
	public int playerID;
	public string mapName;
	public string roomName;
	public HostData myHostData;
	
	
	// Use this for initialization
	void Start () {
		//rr = GameObject.FindGameObjectWithTag("ReadyRoom").GetComponent<ReadyRoomScript>();
	}
	
	// Update is called once per frame
	void Update () {
	
	}
	
	public void giveData(HostData host)
	{
		myHostData = host;
		string com = host.comment;
		string[] dataInfo = com.Split('_');
		roomName = dataInfo[0];
		playerName = dataInfo[1];
		mapName = dataInfo[2];
		playerID = int.Parse(dataInfo[3]);
	}
	
	public void updateData()
	{
		lobbyHandles lb = GameObject.FindGameObjectWithTag("SceneManager").GetComponent<lobbyHandles>();
		lb.joinARoom(myHostData,playerID,mapName);
		//rr.updatePanels(playerID);
	}
}
